package com.epfly.promo.base;

import com.google.common.base.Joiner;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public class Main {
    public static void main(String[] args) {

        List<String> ll = new ArrayList<>();

        Function fun1 = new Function<String, String>() {
            @Override
            public String apply(String e) {
                String t = e.concat("1");
                System.out.println(t);
                return t;
            }
        };

        Function fun2 = new Function<String, String>() {
            @Override
            public String apply(String e) {
                String t = e.concat("2");
                System.out.println(t);
                return t;
            }
        };

        Function fun3 = new Function<String, String>() {
            @Override
            public String apply(String e) {
                String t = e.concat("3");
                System.out.println(t);
                return t;
            }
        };

        Stream<String> stringStream = Arrays.asList("AA", "BB", "CC", "DD").parallelStream();
        stringStream = stringStream.map(fun1);
        stringStream = stringStream.map(fun2);
        stringStream = stringStream.map(fun3);
        List<String> collect = stringStream.collect(Collectors.toList());
        System.out.println(Joiner.on(',').join(collect));
        System.out.println("=========<<<3>>>=========");

    }


}